home *** CD-ROM | disk | FTP | other *** search
/ Experimental BBS Explossion 3 / Experimental BBS Explossion III.iso / sound / sndblst3.zip / SB.DOC < prev    next >
Text File  |  1993-10-22  |  5KB  |  162 lines

  1.  
  2. Programming the Sound Blaster ADC/DAC:
  3.  
  4. 2x6h    DSP Reset Port                       Write Only
  5. 2xAh    DSP Read Data Port                   Read Only
  6. 2xCh    DSP Write Data or Command            Write
  7. 2xCh    DSP Write Buffer Status (bit 7)      Read
  8. 2xEh    DSP Data Available Status Bit 7)     Read Only
  9.  
  10. x = 1,2,3,4,5,6 for the Sound Blaster <= 1.5
  11. x = 1,2,3,4,5,6 for the Sound Blaster Micro Channel Version
  12. x = 2,4 for the Sound Blaster 2.0
  13. x = 2,4 for the Sound Blaster Pro
  14.  
  15. Some DSP Commands:
  16.  
  17. 10h  Direct mode 8-bit DAC (single byte data transfer)
  18. 14h  DMA mode 8-bit DAC
  19. 20h  Direct mode 8-bit ADC (single byte data transfer)
  20. 24h  DMA mode 8-bit ADC
  21. 40h  Set Time Constant
  22. 48h  Set Block Size
  23. 91h  High Speed DMA mode 8-bit DAC
  24. 99h  High Speed DMA mode 8-bit ADC
  25. D1h  Turn on Speaker
  26. D3h  Turn off Speaker
  27. D0h  Halt DMA in progress
  28. D4h  Continue DMA
  29.  
  30. To reset the DSP:
  31.  
  32. 1.  Write a 01h to port 2x6h
  33. 2.  Wait for 3 microseconds
  34. 3.  Write a 00h to port 2x6h
  35. 4.  Read port 2xAh until a 0AAh is read (see below for how to read from 2xAh)
  36.  
  37. If there is no 0AAh after about 100 reads, abort and declare that there is no
  38. Sound Blaster present (or error)
  39.  
  40. To write to the DSP (all writes to 2xCh MUST follow this procedure)
  41.  
  42. 1.  Read 2xCh until bit 7 is clear
  43. 2.  Write to 2xCh
  44.  
  45. To read from the DSP (all reads from 2xAh MUST follow this procedure)
  46.  
  47. 1.  Read 2xEh until bit 7 is set
  48. 2.  Read from 2xAh
  49.  
  50. Interrupts:
  51.  
  52.     In DMA DAC and DMA ADC modes, a single interrupt will occur after the
  53. block of data has been read/written.  To clear the interrupt, read 2xEh
  54. once (as well as clearing the PIC).
  55.  
  56. Ignoring Interrupts:
  57.  
  58.     The interrupt can be ignored if you poll the DMAC (DMA Controller).
  59. Once the DMAC reports a count of 0FFFFh the transfer is finished, read
  60. 2xEh once and you are finished.
  61.  
  62. Note to VESA/Local Bus Video users:
  63.  
  64.     These video cards use DMA channel 1 which is the DMA channel used by
  65. the Sound Blaster.  Any video accesses will screw up the output of the
  66. Sound Blaster.
  67.  
  68. Calculating the Time Constant:
  69.     Normal Speed:
  70.         Time Constant = 256 - (1,000,000 / sampling rate)
  71.                       = 256 - (1,000,000 / 8,000 )
  72.                       = 131
  73.  
  74.     High Speed:
  75.         Time Constant = (MSByte of) 65536 - (256,000,000 / sampling rate)
  76.                       = (MSByte of) 65536 - (256,000,000 / 44,100)
  77.                       = (MSByte of) 59731
  78.                       = (MSByte of) 0E953h
  79.                       = 0E9h
  80.  
  81. Direct mode DAC:
  82.  
  83. 1.  Write a D1h to 2xCh
  84. 2.  Write a 10h to 2xCh
  85. 3.  Write the 8-bit data sample to 2xCh
  86. 4.  Wait for the correct timing (must do your own timing)
  87.     Repeat steps 2-4 until end of data
  88. 5.  Write a D3h to 2xCh
  89.  
  90. Normal speed DMA mode DAC:
  91.  
  92. 1.  Write a D1h to 2xCh
  93. 2.  Setup Interrupt service routine
  94. 3.  Write a 40h to 2xCh
  95. 4.  Write Time Constant to 2xCh
  96. 5.  Program the DMAC (DMA Controller)
  97. 6.  Write 14h to 2xCh
  98. 7.  Write the LSByte of Data Length - 1
  99. 8.  Write the MSByte of Data Length - 1
  100. 9.  Service Interrupt (may need to repeat steps 5-7 in the ISR)
  101. 10. Restore original Interrupt Service Routine
  102. 11. Write a D3h to 2xCh
  103.  
  104. Commands can be written to the DSP while waiting for the interrupt
  105.  
  106. High speed DMA mode DAC:
  107.  
  108. 1.  Write a D1h to 2xCh
  109. 2.  Setup Interrupt service routine
  110. 3.  Write a 40h to 2xCh
  111. 4.  Write Time Constant to 2xCh
  112. 5.  Program the DMAC (DMA Controller)
  113. 6.  Write 48h to 2xCh
  114. 7.  Write the LSByte of Data Length - 1
  115. 8.  Write the MSByte of Data Length - 1
  116. 9.  Write 91h to 2xCh
  117. 10. Service Interrupt (may need to repeat steps 5-7 in the ISR)
  118. 11. Restore original Interrupt Service Routine
  119. 12. Write a D3h to 2xCh
  120.  
  121. Commands CANNOT be written to the DSP while waiting for the interrupt
  122. Resetting the DSP is the procedure used to halt DMA in progress
  123.  
  124.  
  125. Direct mode ADC:
  126.  
  127. 1.  Write a 20h to 2xCh
  128. 2.  Read the 8-bit data sample from 2xAh
  129. 3.  Wait for the correct timing (must do your own timing)
  130.     Repeat steps 1-3 until finished
  131.  
  132. Normal speed DMA mode ADC:
  133.  
  134. 1.  Setup Interrupt service routine
  135. 2.  Write a 40h to 2xCh
  136. 3.  Write Time Constant to 2xCh
  137. 4.  Program the DMAC (DMA Controller)
  138. 5.  Write 24h to 2xCh
  139. 6.  Write the LSByte of Data Length - 1
  140. 7.  Write the MSByte of Data Length - 1
  141. 8.  Service Interrupt (may need to repeat steps 5-7 in the ISR)
  142. 9.  Restore original Interrupt Service Routine
  143.  
  144. Commands can be written to the DSP while waiting for the interrupt
  145.  
  146. High speed DMA mode ADC:
  147.  
  148. 1.  Setup Interrupt service routine
  149. 2.  Write a 40h to 2xCh
  150. 3.  Write Time Constant to 2xCh
  151. 4.  Program the DMAC (DMA Controller)
  152. 5.  Write 48h to 2xCh
  153. 6.  Write the LSByte of Data Length - 1
  154. 7.  Write the MSByte of Data Length - 1
  155. 8.  Write 99h to 2xCh
  156. 9.  Service Interrupt (may need to repeat steps 5-7 in the ISR)
  157. 10. Restore original Interrupt Service Routine
  158.  
  159. Commands CANNOT be written to the DSP while waiting for the interrupt
  160. Resetting the DSP is the procedure used to halt DMA in progress
  161.  
  162.